package com.xmy.erp.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

import java.util.ArrayList;

@Configuration
public class SwaggerConfig {

    /**
     * 配置swagger的Docket bean
     * @return
     */
    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.OAS_30)  // 指定swagger3.0版本
                .groupName("开发小组")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.xmy.study.controller"))  // 指定扫描的包  常用方式
                .build()
                .apiInfo(createApiInfo());
    }
    /**
     * 配置swagger的ApiInfo bean
     * @return
     */
    @Bean
    public ApiInfo createApiInfo(){
        return new ApiInfo("Swagger"
                ,"Java Api Documentation"
                ,"3.0"
                ,""
                ,new Contact("", "", "")
                ,"Apache 2.0"
                ,""
                ,new ArrayList());
    }
}
